﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Godot.core
{
    public class PropertyInfo
    {
        public Variant.Type type { get; set; }
        public string name { get; set; }
        public PropertyHint hint { get; set; }
        public string hint_string { get; set; }
        public int usage { get; set; }

        public PropertyInfo() 
        { 
            type = Variant.Type.NIL; 
            hint = PropertyHint.PROPERTY_HINT_NONE; 
            usage = (int) PropertyUsageFlags.PROPERTY_USAGE_DEFAULT; 
        }

        public PropertyInfo(Variant.Type p_type, string p_name, PropertyHint p_hint = PropertyHint.PROPERTY_HINT_NONE, string p_hint_string = "",int p_usage = (int)PropertyUsageFlags.PROPERTY_USAGE_DEFAULT) 
        {
		    type = p_type; 
            name = p_name; 
            hint = p_hint; 
            hint_string = p_hint_string; 
            usage = p_usage;
	    }

        public PropertyInfo added_usage(PropertyUsageFlags p_fl)
        {
            PropertyInfo pi = this;
            pi.usage |= (int)p_fl; 
            return pi;
        }
    }

    public enum PropertyHint
    {
        PROPERTY_HINT_NONE, ///< no hint provided.
        PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step"
        PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit
        PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
        PROPERTY_HINT_EXP_EASING, /// exponential easing funciton (Math::ease)
        PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer)
        PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
        PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
        PROPERTY_HINT_ALL_FLAGS,
        PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," 
        PROPERTY_HINT_DIR, ///< a directory path must be passed
        PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
        PROPERTY_HINT_GLOBAL_DIR, ///< a directory path must be passed
        PROPERTY_HINT_RESOURCE_TYPE, ///< a resource object type
        PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines	
        PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color
        PROPERTY_HINT_IMAGE_COMPRESS_LOSSY,
        PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS,
        PROPERTY_HINT_MAX,
    };

    public enum PropertyUsageFlags
    {
        PROPERTY_USAGE_STORAGE = 1,
        PROPERTY_USAGE_EDITOR = 2,
        PROPERTY_USAGE_NETWORK = 4,
        PROPERTY_USAGE_EDITOR_HELPER = 8,
        PROPERTY_USAGE_CHECKABLE = 16, //used for editing global variables
        PROPERTY_USAGE_CHECKED = 32, //used for editing global variables
        PROPERTY_USAGE_INTERNATIONALIZED = 64, //hint for internationalized strings
        PROPERTY_USAGE_BUNDLE = 128, //used for optimized bundles
        PROPERTY_USAGE_CATEGORY = 256,
        PROPERTY_USAGE_STORE_IF_NONZERO = 512, //only store if nonzero

        PROPERTY_USAGE_DEFAULT = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK,
        PROPERTY_USAGE_DEFAULT_INTL = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_NETWORK | PROPERTY_USAGE_INTERNATIONALIZED,
        PROPERTY_USAGE_NOEDITOR = PROPERTY_USAGE_STORAGE | PROPERTY_USAGE_NETWORK,
    };
}
